package main.java.service.impl;

import main.java.dao.TaskDao;
import main.java.dao.impl.TaskDaoImpl;
import main.java.domain.Task;
import main.java.service.TaskService;

import java.util.List;

public class TaskServiceImpl implements TaskService {
    private TaskDao dao = new TaskDaoImpl();

    @Override
    public List<Task> findAll(int id, String type) {
        if (type.equals("TEACHER"))
            return dao.findTeacherAll(id);
        return dao.findAll(id);
    }

    @Override
    public Task find(int id) {
        return dao.find(id);
    }

    @Override
    public List<Task> findTaskFileList(int id) {
        return dao.findTaskFileList(id);
    }

    @Override
    public boolean add(String name, String stime, String etime, int id, String path) {
        System.out.println("title:" + name);
        System.out.println("time:" + stime);
        System.out.println("textarea:" + etime);
        System.out.println("id:" + id);
        System.out.println("path:" + path);
        System.out.println("================");
        return dao.add(name, stime, etime, id, path);
    }
}
